<include file="public@header" />
<style>
	.font_red{
		color: red;
	}
</style>
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="">融翠市场统计</a></li>
		</ul>
		<form class="well form-inline margin-top-20" method="get" action="">
			姓名:
			<input type="text" class="form-control" name="keyword" style="width: 200px;"
				   value="{:input('request.keyword/s','')}" placeholder="请输入关键字...">
			部门：
			<select class="form-control" name="dep_id">
				{$deps}
			</select>
			<input type="submit" class="btn btn-primary" value="搜索"/>
			<a class="btn btn-danger" href="">清空</a>
		</form>
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<th>姓名</th>
					<th>所属部门</th>
					<th>市场跟进数量<span class="font_red">（当天）</span></th>
					<volist name="natures" id="nature">
						<th>{$nature.name}<span class="font_red">（当天）</span></th>
					</volist>
				</tr>
			</thead>
			<tbody>
			<php>$sum = [];</php>
			<foreach name="lists" item="vo">
				<tr>
					<td>{$vo.user_nickname}</td>
					<td>{$vo.depname}</td>
					<td>
						{$vo.fcount?:0}<span class="font_red">({$vo.fcount_day?:0})</span>
						<php>
							if(!isset($sum['fcount'])){
							$sum['fcount'] = 0;
							}
							$sum['fcount'] += intval($vo['fcount']);
							if(!isset($sum['fcount_day'])){
							$sum['fcount_day'] = 0;
							}
							$sum['fcount_day'] += intval($vo['fcount_day']);
						</php>
					</td>
					<volist name="natures" id="nature">
						<th>{$vo['ncount_'.$nature['id']]?:0}<span class="font_red">({$vo['ncount_day_'.$nature['id']]?:0})</span></th>
						<php>
							if(!isset($sum['ncount_'.$nature['id']])){
							$sum['ncount_'.$nature['id']] = 0;
							}
							$sum['ncount_'.$nature['id']] += intval($vo['ncount_'.$nature['id']]);
							if(!isset($sum['ncount_day_'.$nature['id']])){
							$sum['ncount_day_'.$nature['id']] = 0;
							}
							$sum['ncount_day_'.$nature['id']] += intval($vo['ncount_day_'.$nature['id']]);
						</php>
					</volist>
				</tr>
			</foreach>
			</tbody>
			<tfoot>
			<tr>
				<th>总计：</th>
				<th></th>
				<th>{$sum.fcount?:0}<span class="font_red">({$sum.fcount_day?:0})</span></th>
				<volist name="natures" id="nature">
					<th>{$sum['ncount_'.$nature['id']]?:0}<span class="font_red">({$sum['ncount_day_'.$nature['id']]?:0})</span></th>
				</volist>
			</tr>
			</tfoot>
		</table>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
</html>